package cn.bytecollege.admin.service;

import cn.bytecollege.admin.dao.OrdersDao;
import cn.bytecollege.admin.dao.MerchantDao;
import cn.bytecollege.admin.dao.MerchantDao;
import cn.bytecollege.admin.dao.OrdersDao;
import cn.bytecollege.admin.dao.UserDao;
import cn.bytecollege.common.entity.Merchant;

import java.util.HashMap;
import java.util.Map;

public class ConsoleService {
    private OrdersDao ordersDao = null;
    private UserDao userDao = null;
    private MerchantDao merchantDao = null;

    public ConsoleService(){
        ordersDao = new OrdersDao();
        userDao = new UserDao();
        merchantDao = new MerchantDao();
    }

    /**
     * 统计数据
     * @return
     */
    public Map<String, Integer> count(){
        //统计总注册用户数
        int userCount = userDao.count();
        //统计总订单数
        int ordersCount = ordersDao.count();
        //统计总商家数
        int merchantCount = merchantDao.count();

        Map<String,Integer> map = new HashMap<>();
        map.put("userCount",userCount);
        map.put("ordersCount",ordersCount);
        map.put("merchantCount",merchantCount);

        return map;

    }
}
